package com.company.batch.rest;

import org.springframework.batch.core.JobParametersInvalidException;
import org.springframework.batch.core.repository.JobExecutionAlreadyRunningException;
import org.springframework.batch.core.repository.JobInstanceAlreadyCompleteException;
import org.springframework.batch.core.repository.JobRestartException;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.company.batch.InvokerJob;

@Controller
public class RestServiceBatch extends InvokerJob{

	@RequestMapping(value = "/file/load", method = RequestMethod.POST)
	public @ResponseBody
	String loadFiles(@RequestParam("realFileName") String realFileName,
			@RequestParam("jobName") String jobName)
			throws JobExecutionAlreadyRunningException, JobRestartException, JobInstanceAlreadyCompleteException, JobParametersInvalidException {
		return super.executeJob(realFileName,jobName);
	}
	

}
